package com.kara.woodAgent.agent.wood;

import com.kara.woodAgent.agent.graph.impl.GraphNodeImpl;
import com.kara.woodAgent.agent.model.ModelProvider;
import com.kara.woodAgent.agent.tool.provider.ToolProvider;
import com.kara.woodAgent.agent.wood.context.WoodContext;
import com.kara.woodAgent.agent.wood.context.WoodReactContext;
import com.kara.woodAgent.agent.wood.model.SpecialAgentWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class SpecialAgentConfig {

    @Autowired
    private ToolProvider toolProvider;


    @Autowired
    private ModelProvider modelProvider;


//    @Bean("file")
//    public SpecialAgentWrapper fileSpecialAgent() {
//        ToolProvider.ToolServiceHolder serviceHolder = toolProvider.getToolService(List.of("file", "system"));
//
//        SubGraphNodeImpl<WoodContext, WoodReactContext> subNode = SpecialAgentTemplate.createSubGraphNode(modelProvider, serviceHolder);
//
//        SpecialAgentWrapper specialAgentWrapper = new SpecialAgentWrapper();
//        specialAgentWrapper.setGraph(subNode);
//        specialAgentWrapper.setDescription("本地文件交互智能体,可以实现和本地操作系统io文件交互，包括创建，读取，写入等操作");
//        specialAgentWrapper.setAgentName("file");
//        return specialAgentWrapper;
//    }


    @Bean
    public SpecialAgentWrapper writerSpecialAgent() {
        ToolProvider.ToolServiceHolder serviceHolder = toolProvider.getToolService(List.of("file", "search", "system", "time"));

        GraphNodeImpl<WoodContext, WoodReactContext> subNode = SpecialAgentTemplate.createGraphNode(modelProvider, serviceHolder);

        SpecialAgentWrapper specialAgentWrapper = new SpecialAgentWrapper();
        specialAgentWrapper.setGraph(subNode);
        specialAgentWrapper.setAgentName("executor");
        return specialAgentWrapper;
    }


//    @Bean("search")
//    public SpecialAgentWrapper searchSpecialAgent() {
//        ToolProvider.ToolServiceHolder serviceHolder = toolProvider.getToolService(List.of("search", "system"));
//
//        SubGraphNodeImpl<WoodContext, WoodReactContext> subNode = SpecialAgentTemplate.createSubGraphNode(modelProvider, serviceHolder);
//
//        SpecialAgentWrapper specialAgentWrapper = new SpecialAgentWrapper();
//        specialAgentWrapper.setGraph(subNode);
//        specialAgentWrapper.setDescription("网络搜索智能体，可以实现联网搜索操作，访问网页等");
//        specialAgentWrapper.setAgentName("search");
//        return specialAgentWrapper;
//    }
//
//
//    @Bean("time")
//    public SpecialAgentWrapper timeSpecialAgent() {
//        ToolProvider.ToolServiceHolder serviceHolder = toolProvider.getToolService(List.of("time", "system"));
//
//        SubGraphNodeImpl<WoodContext, WoodReactContext> subNode = SpecialAgentTemplate.createSubGraphNode(modelProvider, serviceHolder);
//
//        SpecialAgentWrapper specialAgentWrapper = new SpecialAgentWrapper();
//        specialAgentWrapper.setGraph(subNode);
//        specialAgentWrapper.setDescription("时间智能体，可以获得当前时间，可以用于和时间获取相关的问题");
//        specialAgentWrapper.setAgentName("time");
//        return specialAgentWrapper;
//    }
}
